package c.e.a.c.j;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.FontMetrics;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.PointF;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.graphics.drawable.RippleDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.OvalShape;
import android.os.Build.VERSION;
import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
import b.i.b.f;
import c.e.a.c.t.g;
import c.e.a.c.t.j;
import com.pgl.sys.ces.out.ISdkLite;
import java.lang.ref.WeakReference;
import java.util.Arrays;

/* compiled from: ChipDrawable */
public class b extends g implements b.i.d.l.a, Callback, c.e.a.c.p.g.b {
    public static final int[] I0 = new int[]{16842910};
    public static final ShapeDrawable J0 = new ShapeDrawable(new OvalShape());
    public float A;
    public int[] A0;
    public float B = -1.0f;
    public boolean B0;
    public ColorStateList C;
    public ColorStateList C0;
    public float D;
    public WeakReference<a> D0 = new WeakReference(null);
    public ColorStateList E;
    public TruncateAt E0;
    public CharSequence F;
    public boolean F0;
    public boolean G;
    public int G0;
    public Drawable H;
    public boolean H0;
    public ColorStateList I;
    public float J;
    public boolean K;
    public boolean L;
    public Drawable M;
    public Drawable N;
    public ColorStateList O;
    public float P;
    public CharSequence Q;
    public boolean R;
    public boolean S;
    public Drawable T;
    public ColorStateList U;
    public c.e.a.c.c.g V;
    public c.e.a.c.c.g W;
    public float X;
    public float Y;
    public float Z;
    public float b0;
    public float c0;
    public float d0;
    public float e0;
    public float f0;
    public final Context g0;
    public final Paint h0 = new Paint(1);
    public final FontMetrics i0 = new FontMetrics();
    public final RectF j0 = new RectF();
    public final PointF k0 = new PointF();
    public final Path l0 = new Path();
    public final c.e.a.c.p.g m0;
    public int n0;
    public int o0;
    public int p0;
    public int q0;
    public int r0;
    public int s0;
    public boolean t0;
    public int u0;
    public int v0 = ISdkLite.REGION_UNSET;
    public ColorFilter w0;
    public PorterDuffColorFilter x0;
    public ColorStateList y;
    public ColorStateList y0;
    public ColorStateList z;
    public Mode z0 = Mode.SRC_IN;

    /* compiled from: ChipDrawable */
    public interface a {
        void a();
    }

    public b(Context context, AttributeSet attributeSet, int i, int i2) {
        super(j.b(context, attributeSet, i, i2, new c.e.a.c.t.a((float) 0)).a());
        this.a.b = new c.e.a.c.m.a(context);
        w();
        this.g0 = context;
        c.e.a.c.p.g gVar = new c.e.a.c.p.g(this);
        this.m0 = gVar;
        this.F = "";
        gVar.a.density = context.getResources().getDisplayMetrics().density;
        int[] iArr = I0;
        setState(iArr);
        c0(iArr);
        this.F0 = true;
        iArr = c.e.a.c.r.a.a;
        J0.setTint(-1);
    }

    public static boolean F(ColorStateList colorStateList) {
        return colorStateList != null && colorStateList.isStateful();
    }

    public static boolean G(Drawable drawable) {
        return drawable != null && drawable.isStateful();
    }

    public final void A(Rect rect, RectF rectF) {
        rectF.setEmpty();
        if (p0()) {
            float f = this.f0 + this.e0;
            float f2;
            if (f.u0(this) == 0) {
                f2 = ((float) rect.right) - f;
                rectF.right = f2;
                rectF.left = f2 - this.P;
            } else {
                f2 = ((float) rect.left) + f;
                rectF.left = f2;
                rectF.right = f2 + this.P;
            }
            float exactCenterY = rect.exactCenterY();
            f = this.P;
            exactCenterY -= f / 2.0f;
            rectF.top = exactCenterY;
            rectF.bottom = exactCenterY + f;
        }
    }

    public final void B(Rect rect, RectF rectF) {
        rectF.setEmpty();
        if (p0()) {
            float f = (((this.f0 + this.e0) + this.P) + this.d0) + this.c0;
            if (f.u0(this) == 0) {
                float f2 = (float) rect.right;
                rectF.right = f2;
                rectF.left = f2 - f;
            } else {
                int i = rect.left;
                rectF.left = (float) i;
                rectF.right = ((float) i) + f;
            }
            rectF.top = (float) rect.top;
            rectF.bottom = (float) rect.bottom;
        }
    }

    public float C() {
        return p0() ? (this.d0 + this.P) + this.e0 : 0.0f;
    }

    public float D() {
        return this.H0 ? l() : this.B;
    }

    public Drawable E() {
        Drawable drawable = this.M;
        if (drawable != null) {
            return drawable instanceof b.i.d.l.b ? ((b.i.d.l.b) drawable).b() : drawable;
        } else {
            return null;
        }
    }

    public void H() {
        a aVar = (a) this.D0.get();
        if (aVar != null) {
            aVar.a();
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:78:0x00df  */
    /* JADX WARNING: Removed duplicated region for block: B:77:0x00d8  */
    /* JADX WARNING: Removed duplicated region for block: B:82:0x00f1  */
    /* JADX WARNING: Removed duplicated region for block: B:81:0x00e4  */
    /* JADX WARNING: Removed duplicated region for block: B:85:0x00fa  */
    /* JADX WARNING: Removed duplicated region for block: B:88:0x0109  */
    /* JADX WARNING: Removed duplicated region for block: B:91:0x0118  */
    /* JADX WARNING: Removed duplicated region for block: B:94:0x0137  */
    /* JADX WARNING: Removed duplicated region for block: B:96:0x0140  */
    /* JADX WARNING: Removed duplicated region for block: B:98:0x0145  */
    /* JADX WARNING: Removed duplicated region for block: B:51:0x0095  */
    /* JADX WARNING: Removed duplicated region for block: B:54:0x00a2  */
    /* JADX WARNING: Removed duplicated region for block: B:73:0x00d2  */
    /* JADX WARNING: Removed duplicated region for block: B:72:0x00cf  */
    public final boolean I(int[] r9, int[] r10) {
        /*
        r8 = this;
        r0 = super.onStateChange(r9);
        r1 = r8.y;
        r2 = 0;
        if (r1 == 0) goto L_0x0010;
    L_0x0009:
        r3 = r8.n0;
        r1 = r1.getColorForState(r9, r3);
        goto L_0x0011;
    L_0x0010:
        r1 = 0;
    L_0x0011:
        r3 = r8.n0;
        r4 = 1;
        if (r3 == r1) goto L_0x0019;
    L_0x0016:
        r8.n0 = r1;
        r0 = 1;
    L_0x0019:
        r3 = r8.z;
        if (r3 == 0) goto L_0x0024;
    L_0x001d:
        r5 = r8.o0;
        r3 = r3.getColorForState(r9, r5);
        goto L_0x0025;
    L_0x0024:
        r3 = 0;
    L_0x0025:
        r5 = r8.o0;
        if (r5 == r3) goto L_0x002c;
    L_0x0029:
        r8.o0 = r3;
        r0 = 1;
    L_0x002c:
        r1 = b.i.d.a.a(r3, r1);
        r3 = r8.p0;
        if (r3 == r1) goto L_0x0036;
    L_0x0034:
        r3 = 1;
        goto L_0x0037;
    L_0x0036:
        r3 = 0;
    L_0x0037:
        r5 = r8.a;
        r5 = r5.d;
        if (r5 != 0) goto L_0x003f;
    L_0x003d:
        r5 = 1;
        goto L_0x0040;
    L_0x003f:
        r5 = 0;
    L_0x0040:
        r3 = r3 | r5;
        if (r3 == 0) goto L_0x004d;
    L_0x0043:
        r8.p0 = r1;
        r0 = android.content.res.ColorStateList.valueOf(r1);
        r8.p(r0);
        r0 = 1;
    L_0x004d:
        r1 = r8.C;
        if (r1 == 0) goto L_0x0058;
    L_0x0051:
        r3 = r8.q0;
        r1 = r1.getColorForState(r9, r3);
        goto L_0x0059;
    L_0x0058:
        r1 = 0;
    L_0x0059:
        r3 = r8.q0;
        if (r3 == r1) goto L_0x0060;
    L_0x005d:
        r8.q0 = r1;
        r0 = 1;
    L_0x0060:
        r1 = r8.C0;
        if (r1 == 0) goto L_0x0073;
    L_0x0064:
        r1 = c.e.a.c.r.a.c(r9);
        if (r1 == 0) goto L_0x0073;
    L_0x006a:
        r1 = r8.C0;
        r3 = r8.r0;
        r1 = r1.getColorForState(r9, r3);
        goto L_0x0074;
    L_0x0073:
        r1 = 0;
    L_0x0074:
        r3 = r8.r0;
        if (r3 == r1) goto L_0x007f;
    L_0x0078:
        r8.r0 = r1;
        r1 = r8.B0;
        if (r1 == 0) goto L_0x007f;
    L_0x007e:
        r0 = 1;
    L_0x007f:
        r1 = r8.m0;
        r1 = r1.f;
        if (r1 == 0) goto L_0x0090;
    L_0x0085:
        r1 = r1.b;
        if (r1 == 0) goto L_0x0090;
    L_0x0089:
        r3 = r8.s0;
        r1 = r1.getColorForState(r9, r3);
        goto L_0x0091;
    L_0x0090:
        r1 = 0;
    L_0x0091:
        r3 = r8.s0;
        if (r3 == r1) goto L_0x0098;
    L_0x0095:
        r8.s0 = r1;
        r0 = 1;
    L_0x0098:
        r1 = r8.getState();
        r3 = 16842912; // 0x10100a0 float:2.3694006E-38 double:8.321504E-317;
        if (r1 != 0) goto L_0x00a2;
    L_0x00a1:
        goto L_0x00af;
    L_0x00a2:
        r5 = r1.length;
        r6 = 0;
    L_0x00a4:
        if (r6 >= r5) goto L_0x00af;
    L_0x00a6:
        r7 = r1[r6];
        if (r7 != r3) goto L_0x00ac;
    L_0x00aa:
        r1 = 1;
        goto L_0x00b0;
    L_0x00ac:
        r6 = r6 + 1;
        goto L_0x00a4;
    L_0x00af:
        r1 = 0;
    L_0x00b0:
        if (r1 == 0) goto L_0x00b8;
    L_0x00b2:
        r1 = r8.R;
        if (r1 == 0) goto L_0x00b8;
    L_0x00b6:
        r1 = 1;
        goto L_0x00b9;
    L_0x00b8:
        r1 = 0;
    L_0x00b9:
        r3 = r8.t0;
        if (r3 == r1) goto L_0x00d3;
    L_0x00bd:
        r3 = r8.T;
        if (r3 == 0) goto L_0x00d3;
    L_0x00c1:
        r0 = r8.z();
        r8.t0 = r1;
        r1 = r8.z();
        r0 = (r0 > r1 ? 1 : (r0 == r1 ? 0 : -1));
        if (r0 == 0) goto L_0x00d2;
    L_0x00cf:
        r0 = 1;
        r1 = 1;
        goto L_0x00d4;
    L_0x00d2:
        r0 = 1;
    L_0x00d3:
        r1 = 0;
    L_0x00d4:
        r3 = r8.y0;
        if (r3 == 0) goto L_0x00df;
    L_0x00d8:
        r5 = r8.u0;
        r3 = r3.getColorForState(r9, r5);
        goto L_0x00e0;
    L_0x00df:
        r3 = 0;
    L_0x00e0:
        r5 = r8.u0;
        if (r5 == r3) goto L_0x00f1;
    L_0x00e4:
        r8.u0 = r3;
        r0 = r8.y0;
        r3 = r8.z0;
        r0 = c.e.a.c.a.x(r8, r0, r3);
        r8.x0 = r0;
        goto L_0x00f2;
    L_0x00f1:
        r4 = r0;
    L_0x00f2:
        r0 = r8.H;
        r0 = G(r0);
        if (r0 == 0) goto L_0x0101;
    L_0x00fa:
        r0 = r8.H;
        r0 = r0.setState(r9);
        r4 = r4 | r0;
    L_0x0101:
        r0 = r8.T;
        r0 = G(r0);
        if (r0 == 0) goto L_0x0110;
    L_0x0109:
        r0 = r8.T;
        r0 = r0.setState(r9);
        r4 = r4 | r0;
    L_0x0110:
        r0 = r8.M;
        r0 = G(r0);
        if (r0 == 0) goto L_0x012d;
    L_0x0118:
        r0 = r9.length;
        r3 = r10.length;
        r0 = r0 + r3;
        r0 = new int[r0];
        r3 = r9.length;
        java.lang.System.arraycopy(r9, r2, r0, r2, r3);
        r9 = r9.length;
        r3 = r10.length;
        java.lang.System.arraycopy(r10, r2, r0, r9, r3);
        r9 = r8.M;
        r9 = r9.setState(r0);
        r4 = r4 | r9;
    L_0x012d:
        r9 = c.e.a.c.r.a.a;
        r9 = r8.N;
        r9 = G(r9);
        if (r9 == 0) goto L_0x013e;
    L_0x0137:
        r9 = r8.N;
        r9 = r9.setState(r10);
        r4 = r4 | r9;
    L_0x013e:
        if (r4 == 0) goto L_0x0143;
    L_0x0140:
        r8.invalidateSelf();
    L_0x0143:
        if (r1 == 0) goto L_0x0148;
    L_0x0145:
        r8.H();
    L_0x0148:
        return r4;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.a.c.j.b.I(int[], int[]):boolean");
    }

    public void J(boolean z) {
        if (this.R != z) {
            this.R = z;
            float z2 = z();
            if (!z && this.t0) {
                this.t0 = false;
            }
            float z3 = z();
            invalidateSelf();
            if (z2 != z3) {
                H();
            }
        }
    }

    public void K(Drawable drawable) {
        if (this.T != drawable) {
            float z = z();
            this.T = drawable;
            float z2 = z();
            q0(this.T);
            x(this.T);
            invalidateSelf();
            if (z != z2) {
                H();
            }
        }
    }

    public void L(ColorStateList colorStateList) {
        if (this.U != colorStateList) {
            this.U = colorStateList;
            Object obj = (this.S && this.T != null && this.R) ? 1 : null;
            if (obj != null) {
                this.T.setTintList(colorStateList);
            }
            onStateChange(getState());
        }
    }

    public void M(boolean z) {
        if (this.S != z) {
            boolean n0 = n0();
            this.S = z;
            z = n0();
            if ((n0 != z ? 1 : null) != null) {
                if (z) {
                    x(this.T);
                } else {
                    q0(this.T);
                }
                invalidateSelf();
                H();
            }
        }
    }

    public void N(ColorStateList colorStateList) {
        if (this.z != colorStateList) {
            this.z = colorStateList;
            onStateChange(getState());
        }
    }

    @Deprecated
    public void O(float f) {
        if (this.B != f) {
            this.B = f;
            this.a.a = this.a.a.e(f);
            invalidateSelf();
        }
    }

    public void P(float f) {
        if (this.f0 != f) {
            this.f0 = f;
            invalidateSelf();
            H();
        }
    }

    public void Q(Drawable drawable) {
        Drawable drawable2 = this.H;
        Drawable drawable3 = null;
        if (drawable2 == null) {
            drawable2 = null;
        } else if (drawable2 instanceof b.i.d.l.b) {
            drawable2 = ((b.i.d.l.b) drawable2).b();
        }
        if (drawable2 != drawable) {
            float z = z();
            if (drawable != null) {
                drawable3 = f.k1(drawable).mutate();
            }
            this.H = drawable3;
            float z2 = z();
            q0(drawable2);
            if (o0()) {
                x(this.H);
            }
            invalidateSelf();
            if (z != z2) {
                H();
            }
        }
    }

    public void R(float f) {
        if (this.J != f) {
            float z = z();
            this.J = f;
            f = z();
            invalidateSelf();
            if (z != f) {
                H();
            }
        }
    }

    public void S(ColorStateList colorStateList) {
        this.K = true;
        if (this.I != colorStateList) {
            this.I = colorStateList;
            if (o0()) {
                this.H.setTintList(colorStateList);
            }
            onStateChange(getState());
        }
    }

    public void T(boolean z) {
        if (this.G != z) {
            boolean o0 = o0();
            this.G = z;
            z = o0();
            if ((o0 != z ? 1 : null) != null) {
                if (z) {
                    x(this.H);
                } else {
                    q0(this.H);
                }
                invalidateSelf();
                H();
            }
        }
    }

    public void U(float f) {
        if (this.A != f) {
            this.A = f;
            invalidateSelf();
            H();
        }
    }

    public void V(float f) {
        if (this.X != f) {
            this.X = f;
            invalidateSelf();
            H();
        }
    }

    public void W(ColorStateList colorStateList) {
        if (this.C != colorStateList) {
            this.C = colorStateList;
            if (this.H0) {
                t(colorStateList);
            }
            onStateChange(getState());
        }
    }

    public void X(float f) {
        if (this.D != f) {
            this.D = f;
            this.h0.setStrokeWidth(f);
            if (this.H0) {
                this.a.l = f;
                invalidateSelf();
            }
            invalidateSelf();
        }
    }

    public void Y(Drawable drawable) {
        Drawable E = E();
        if (E != drawable) {
            float C = C();
            this.M = drawable != null ? f.k1(drawable).mutate() : null;
            int[] iArr = c.e.a.c.r.a.a;
            this.N = new RippleDrawable(c.e.a.c.r.a.b(this.E), this.M, J0);
            float C2 = C();
            q0(E);
            if (p0()) {
                x(this.M);
            }
            invalidateSelf();
            if (C != C2) {
                H();
            }
        }
    }

    public void Z(float f) {
        if (this.e0 != f) {
            this.e0 = f;
            invalidateSelf();
            if (p0()) {
                H();
            }
        }
    }

    public void a() {
        H();
        invalidateSelf();
    }

    public void a0(float f) {
        if (this.P != f) {
            this.P = f;
            invalidateSelf();
            if (p0()) {
                H();
            }
        }
    }

    public void b0(float f) {
        if (this.d0 != f) {
            this.d0 = f;
            invalidateSelf();
            if (p0()) {
                H();
            }
        }
    }

    public boolean c0(int[] iArr) {
        if (!Arrays.equals(this.A0, iArr)) {
            this.A0 = iArr;
            if (p0()) {
                return I(getState(), iArr);
            }
        }
        return false;
    }

    public void d0(ColorStateList colorStateList) {
        if (this.O != colorStateList) {
            this.O = colorStateList;
            if (p0()) {
                this.M.setTintList(colorStateList);
            }
            onStateChange(getState());
        }
    }

    public void draw(Canvas canvas) {
        Canvas canvas2 = canvas;
        Rect bounds = getBounds();
        if (!bounds.isEmpty()) {
            int i = this.v0;
            if (i != 0) {
                float f;
                int saveLayerAlpha;
                int i2;
                Paint paint;
                ColorFilter colorFilter;
                float f2;
                float f3;
                RectF rectF;
                float f4;
                int i3;
                int i4;
                int i5;
                if (i < ISdkLite.REGION_UNSET) {
                    float f5 = (float) bounds.left;
                    float f6 = (float) bounds.top;
                    float f7 = (float) bounds.right;
                    f = (float) bounds.bottom;
                    if (VERSION.SDK_INT > 21) {
                        saveLayerAlpha = canvas.saveLayerAlpha(f5, f6, f7, f, i);
                    } else {
                        saveLayerAlpha = canvas.saveLayerAlpha(f5, f6, f7, f, i, 31);
                    }
                    i2 = saveLayerAlpha;
                } else {
                    i2 = 0;
                }
                if (!this.H0) {
                    this.h0.setColor(this.n0);
                    this.h0.setStyle(Style.FILL);
                    this.j0.set(bounds);
                    canvas2.drawRoundRect(this.j0, D(), D(), this.h0);
                }
                if (!this.H0) {
                    this.h0.setColor(this.o0);
                    this.h0.setStyle(Style.FILL);
                    paint = this.h0;
                    colorFilter = this.w0;
                    if (colorFilter == null) {
                        colorFilter = this.x0;
                    }
                    paint.setColorFilter(colorFilter);
                    this.j0.set(bounds);
                    canvas2.drawRoundRect(this.j0, D(), D(), this.h0);
                }
                if (this.H0) {
                    super.draw(canvas);
                }
                if (this.D > 0.0f && !this.H0) {
                    this.h0.setColor(this.q0);
                    this.h0.setStyle(Style.STROKE);
                    if (!this.H0) {
                        paint = this.h0;
                        colorFilter = this.w0;
                        if (colorFilter == null) {
                            colorFilter = this.x0;
                        }
                        paint.setColorFilter(colorFilter);
                    }
                    f2 = this.D / 2.0f;
                    this.j0.set(((float) bounds.left) + f2, ((float) bounds.top) + f2, ((float) bounds.right) - f2, ((float) bounds.bottom) - f2);
                    f3 = this.B - (this.D / 2.0f);
                    canvas2.drawRoundRect(this.j0, f3, f3, this.h0);
                }
                this.h0.setColor(this.r0);
                this.h0.setStyle(Style.FILL);
                this.j0.set(bounds);
                if (this.H0) {
                    c(new RectF(bounds), this.l0);
                    saveLayerAlpha = 0;
                    g(canvas, this.h0, this.l0, this.a.a, h());
                } else {
                    canvas2.drawRoundRect(this.j0, D(), D(), this.h0);
                    saveLayerAlpha = 0;
                }
                if (o0()) {
                    y(bounds, this.j0);
                    rectF = this.j0;
                    f4 = rectF.left;
                    f3 = rectF.top;
                    canvas2.translate(f4, f3);
                    this.H.setBounds(saveLayerAlpha, saveLayerAlpha, (int) this.j0.width(), (int) this.j0.height());
                    this.H.draw(canvas2);
                    canvas2.translate(-f4, -f3);
                }
                if (n0()) {
                    y(bounds, this.j0);
                    rectF = this.j0;
                    f4 = rectF.left;
                    f3 = rectF.top;
                    canvas2.translate(f4, f3);
                    this.T.setBounds(saveLayerAlpha, saveLayerAlpha, (int) this.j0.width(), (int) this.j0.height());
                    this.T.draw(canvas2);
                    canvas2.translate(-f4, -f3);
                }
                if (!this.F0 || this.F == null) {
                    i3 = i2;
                    i4 = ISdkLite.REGION_UNSET;
                    i5 = 0;
                } else {
                    float z;
                    int save;
                    PointF pointF = this.k0;
                    pointF.set(0.0f, 0.0f);
                    Align align = Align.LEFT;
                    if (this.F != null) {
                        f2 = (z() + this.X) + this.b0;
                        if (f.u0(this) == 0) {
                            pointF.x = ((float) bounds.left) + f2;
                            align = Align.LEFT;
                        } else {
                            pointF.x = ((float) bounds.right) - f2;
                            align = Align.RIGHT;
                        }
                        f2 = (float) bounds.centerY();
                        this.m0.a.getFontMetrics(this.i0);
                        FontMetrics fontMetrics = this.i0;
                        pointF.y = f2 - ((fontMetrics.descent + fontMetrics.ascent) / 2.0f);
                    }
                    rectF = this.j0;
                    rectF.setEmpty();
                    if (this.F != null) {
                        z = (z() + this.X) + this.b0;
                        f = (C() + this.f0) + this.c0;
                        if (f.u0(this) == 0) {
                            rectF.left = ((float) bounds.left) + z;
                            rectF.right = ((float) bounds.right) - f;
                        } else {
                            rectF.left = ((float) bounds.left) + f;
                            rectF.right = ((float) bounds.right) - z;
                        }
                        rectF.top = (float) bounds.top;
                        rectF.bottom = (float) bounds.bottom;
                    }
                    c.e.a.c.p.g gVar = this.m0;
                    if (gVar.f != null) {
                        gVar.a.drawableState = getState();
                        gVar = this.m0;
                        gVar.f.c(this.g0, gVar.a, gVar.b);
                    }
                    this.m0.a.setTextAlign(align);
                    Object obj = Math.round(this.m0.a(this.F.toString())) > Math.round(this.j0.width()) ? 1 : null;
                    if (obj != null) {
                        save = canvas.save();
                        canvas2.clipRect(this.j0);
                    } else {
                        save = 0;
                    }
                    CharSequence charSequence = this.F;
                    if (!(obj == null || this.E0 == null)) {
                        charSequence = TextUtils.ellipsize(charSequence, this.m0.a, this.j0.width(), this.E0);
                    }
                    CharSequence charSequence2 = charSequence;
                    int length = charSequence2.length();
                    PointF pointF2 = this.k0;
                    z = pointF2.x;
                    f2 = pointF2.y;
                    Paint paint2 = this.m0.a;
                    Canvas canvas3 = canvas;
                    i5 = 0;
                    float f8 = z;
                    i4 = ISdkLite.REGION_UNSET;
                    float f9 = f2;
                    i3 = i2;
                    canvas3.drawText(charSequence2, 0, length, f8, f9, paint2);
                    if (obj != null) {
                        canvas2.restoreToCount(save);
                    }
                }
                if (p0()) {
                    A(bounds, this.j0);
                    rectF = this.j0;
                    f4 = rectF.left;
                    f3 = rectF.top;
                    canvas2.translate(f4, f3);
                    this.M.setBounds(i5, i5, (int) this.j0.width(), (int) this.j0.height());
                    int[] iArr = c.e.a.c.r.a.a;
                    this.N.setBounds(this.M.getBounds());
                    this.N.jumpToCurrentState();
                    this.N.draw(canvas2);
                    canvas2.translate(-f4, -f3);
                }
                if (this.v0 < i4) {
                    canvas2.restoreToCount(i3);
                }
            }
        }
    }

    public void e0(boolean z) {
        if (this.L != z) {
            boolean p0 = p0();
            this.L = z;
            z = p0();
            if ((p0 != z ? 1 : null) != null) {
                if (z) {
                    x(this.M);
                } else {
                    q0(this.M);
                }
                invalidateSelf();
                H();
            }
        }
    }

    public void f0(float f) {
        if (this.Z != f) {
            float z = z();
            this.Z = f;
            f = z();
            invalidateSelf();
            if (z != f) {
                H();
            }
        }
    }

    public void g0(float f) {
        if (this.Y != f) {
            float z = z();
            this.Y = f;
            f = z();
            invalidateSelf();
            if (z != f) {
                H();
            }
        }
    }

    public int getAlpha() {
        return this.v0;
    }

    public ColorFilter getColorFilter() {
        return this.w0;
    }

    public int getIntrinsicHeight() {
        return (int) this.A;
    }

    public int getIntrinsicWidth() {
        return Math.min(Math.round((C() + ((this.m0.a(this.F.toString()) + ((z() + this.X) + this.b0)) + this.c0)) + this.f0), this.G0);
    }

    public int getOpacity() {
        return -3;
    }

    @TargetApi(21)
    public void getOutline(Outline outline) {
        if (this.H0) {
            super.getOutline(outline);
            return;
        }
        Rect bounds = getBounds();
        if (bounds.isEmpty()) {
            outline.setRoundRect(0, 0, getIntrinsicWidth(), (int) this.A, this.B);
        } else {
            outline.setRoundRect(bounds, this.B);
        }
        outline.setAlpha(((float) this.v0) / 255.0f);
    }

    public void h0(ColorStateList colorStateList) {
        if (this.E != colorStateList) {
            this.E = colorStateList;
            this.C0 = this.B0 ? c.e.a.c.r.a.b(colorStateList) : null;
            onStateChange(getState());
        }
    }

    public void i0(CharSequence charSequence) {
        if (charSequence == null) {
            charSequence = "";
        }
        if (!TextUtils.equals(this.F, charSequence)) {
            this.F = charSequence;
            this.m0.d = true;
            invalidateSelf();
            H();
        }
    }

    public void invalidateDrawable(Drawable drawable) {
        Callback callback = getCallback();
        if (callback != null) {
            callback.invalidateDrawable(this);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:40:? A:{SYNTHETIC, RETURN} */
    /* JADX WARNING: Removed duplicated region for block: B:19:0x003b  */
    public boolean isStateful() {
        /*
        r3 = this;
        r0 = r3.y;
        r0 = F(r0);
        r1 = 1;
        r2 = 0;
        if (r0 != 0) goto L_0x0066;
    L_0x000a:
        r0 = r3.z;
        r0 = F(r0);
        if (r0 != 0) goto L_0x0066;
    L_0x0012:
        r0 = r3.C;
        r0 = F(r0);
        if (r0 != 0) goto L_0x0066;
    L_0x001a:
        r0 = r3.B0;
        if (r0 == 0) goto L_0x0026;
    L_0x001e:
        r0 = r3.C0;
        r0 = F(r0);
        if (r0 != 0) goto L_0x0066;
    L_0x0026:
        r0 = r3.m0;
        r0 = r0.f;
        if (r0 == 0) goto L_0x0038;
    L_0x002c:
        r0 = r0.b;
        if (r0 == 0) goto L_0x0038;
    L_0x0030:
        r0 = r0.isStateful();
        if (r0 == 0) goto L_0x0038;
    L_0x0036:
        r0 = 1;
        goto L_0x0039;
    L_0x0038:
        r0 = 0;
    L_0x0039:
        if (r0 != 0) goto L_0x0066;
    L_0x003b:
        r0 = r3.S;
        if (r0 == 0) goto L_0x0049;
    L_0x003f:
        r0 = r3.T;
        if (r0 == 0) goto L_0x0049;
    L_0x0043:
        r0 = r3.R;
        if (r0 == 0) goto L_0x0049;
    L_0x0047:
        r0 = 1;
        goto L_0x004a;
    L_0x0049:
        r0 = 0;
    L_0x004a:
        if (r0 != 0) goto L_0x0066;
    L_0x004c:
        r0 = r3.H;
        r0 = G(r0);
        if (r0 != 0) goto L_0x0066;
    L_0x0054:
        r0 = r3.T;
        r0 = G(r0);
        if (r0 != 0) goto L_0x0066;
    L_0x005c:
        r0 = r3.y0;
        r0 = F(r0);
        if (r0 == 0) goto L_0x0065;
    L_0x0064:
        goto L_0x0066;
    L_0x0065:
        r1 = 0;
    L_0x0066:
        return r1;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.a.c.j.b.isStateful():boolean");
    }

    public void j0(c.e.a.c.q.b bVar) {
        this.m0.b(bVar, this.g0);
    }

    public void k0(float f) {
        if (this.c0 != f) {
            this.c0 = f;
            invalidateSelf();
            H();
        }
    }

    public void l0(float f) {
        if (this.b0 != f) {
            this.b0 = f;
            invalidateSelf();
            H();
        }
    }

    public void m0(boolean z) {
        if (this.B0 != z) {
            this.B0 = z;
            this.C0 = z ? c.e.a.c.r.a.b(this.E) : null;
            onStateChange(getState());
        }
    }

    public final boolean n0() {
        return this.S && this.T != null && this.t0;
    }

    public final boolean o0() {
        return this.G && this.H != null;
    }

    public boolean onLayoutDirectionChanged(int i) {
        int onLayoutDirectionChanged = super.onLayoutDirectionChanged(i);
        if (o0()) {
            onLayoutDirectionChanged |= f.X0(this.H, i);
        }
        if (n0()) {
            onLayoutDirectionChanged |= f.X0(this.T, i);
        }
        if (p0()) {
            onLayoutDirectionChanged |= f.X0(this.M, i);
        }
        if (onLayoutDirectionChanged != 0) {
            invalidateSelf();
        }
        return true;
    }

    public boolean onLevelChange(int i) {
        boolean onLevelChange = super.onLevelChange(i);
        if (o0()) {
            onLevelChange |= this.H.setLevel(i);
        }
        if (n0()) {
            onLevelChange |= this.T.setLevel(i);
        }
        if (p0()) {
            onLevelChange |= this.M.setLevel(i);
        }
        if (onLevelChange) {
            invalidateSelf();
        }
        return onLevelChange;
    }

    public boolean onStateChange(int[] iArr) {
        if (this.H0) {
            super.onStateChange(iArr);
        }
        return I(iArr, this.A0);
    }

    public final boolean p0() {
        return this.L && this.M != null;
    }

    public final void q0(Drawable drawable) {
        if (drawable != null) {
            drawable.setCallback(null);
        }
    }

    public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) {
        Callback callback = getCallback();
        if (callback != null) {
            callback.scheduleDrawable(this, runnable, j);
        }
    }

    public void setAlpha(int i) {
        if (this.v0 != i) {
            this.v0 = i;
            invalidateSelf();
        }
    }

    public void setColorFilter(ColorFilter colorFilter) {
        if (this.w0 != colorFilter) {
            this.w0 = colorFilter;
            invalidateSelf();
        }
    }

    public void setTintList(ColorStateList colorStateList) {
        if (this.y0 != colorStateList) {
            this.y0 = colorStateList;
            onStateChange(getState());
        }
    }

    public void setTintMode(Mode mode) {
        if (this.z0 != mode) {
            this.z0 = mode;
            this.x0 = c.e.a.c.a.x(this, this.y0, mode);
            invalidateSelf();
        }
    }

    public boolean setVisible(boolean z, boolean z2) {
        boolean visible = super.setVisible(z, z2);
        if (o0()) {
            visible |= this.H.setVisible(z, z2);
        }
        if (n0()) {
            visible |= this.T.setVisible(z, z2);
        }
        if (p0()) {
            visible |= this.M.setVisible(z, z2);
        }
        if (visible) {
            invalidateSelf();
        }
        return visible;
    }

    public void unscheduleDrawable(Drawable drawable, Runnable runnable) {
        Callback callback = getCallback();
        if (callback != null) {
            callback.unscheduleDrawable(this, runnable);
        }
    }

    public final void x(Drawable drawable) {
        if (drawable != null) {
            drawable.setCallback(this);
            f.X0(drawable, f.u0(this));
            drawable.setLevel(getLevel());
            drawable.setVisible(isVisible(), false);
            if (drawable == this.M) {
                if (drawable.isStateful()) {
                    drawable.setState(this.A0);
                }
                drawable.setTintList(this.O);
                return;
            }
            if (drawable.isStateful()) {
                drawable.setState(getState());
            }
            Drawable drawable2 = this.H;
            if (drawable == drawable2 && this.K) {
                drawable2.setTintList(this.I);
            }
        }
    }

    public final void y(Rect rect, RectF rectF) {
        rectF.setEmpty();
        if (o0() || n0()) {
            float f = this.X + this.Y;
            float f2;
            if (f.u0(this) == 0) {
                f2 = ((float) rect.left) + f;
                rectF.left = f2;
                rectF.right = f2 + this.J;
            } else {
                f2 = ((float) rect.right) - f;
                rectF.right = f2;
                rectF.left = f2 - this.J;
            }
            float exactCenterY = rect.exactCenterY();
            f = this.J;
            exactCenterY -= f / 2.0f;
            rectF.top = exactCenterY;
            rectF.bottom = exactCenterY + f;
        }
    }

    public float z() {
        if (o0() || n0()) {
            return (this.Y + this.J) + this.Z;
        }
        return 0.0f;
    }
}
